﻿Imports FixSoft.Fixed.Forms.HyperAero
Imports System.ComponentModel
Imports System.Drawing.Drawing2D
Imports System.Drawing.Design

''' <summary>
''' Add Customization for HyperAero Form to your class.
''' </summary>
Public MustInherit Class UseHyperAero
#Region "UseCodeHG"
    Dim Fsh As New FixSoft.Fixed.Forms.HyperAero
    Protected Overridable Property FrmHyperAero As FixSoft.Fixed.Forms.HyperAero
        Get
            Return Fsh
        End Get
        Set(ByVal value As FixSoft.Fixed.Forms.HyperAero)
            Fsh = value
        End Set
    End Property
#Region "Properties"
    ''' <summary>
    ''' Gets or sets custom sound of start.
    ''' </summary>
    <CategoryAttribute("Sound"),
   Description("A sound for playing on start.")>
    Public Property CustomSound As System.IO.Stream
    ''' <summary>
    ''' Gets or sets Location of custom sound of start.
    ''' </summary>
    <CategoryAttribute("Sound"), DefaultValue(""),
Description("Location of a sound for playing on start.")>
    Public Property CustomSoundLocation As String
    Private speedv As Integer = FrmHyperAero.SpeedOfFade
    ''' <summary>
    ''' Gets or sets fade animation speed.
    ''' Enter a number between 0 - 100.
    ''' </summary>
    <CategoryAttribute("Animation"),
Browsable(True),
[ReadOnly](False),
BindableAttribute(False), DefaultValue(80),
DesignOnly(False),
DescriptionAttribute("The speed of fade.")>
    Public Property SpeedOfFade As Integer
        Get
            Return speedv

        End Get
        Set(ByVal value As Integer)
            If value >= 100 Then
                value = 99
            End If
            speedv = value
        End Set
    End Property
    Private speedtgv As Integer = 1000 - FrmHyperAero.SpeedOfTurnGradient
    ''' <summary>
    ''' Gets or sets gradient turning animation speed.
    ''' Enter a number between 0 - 1000.
    ''' </summary>
    <CategoryAttribute("Animation"),
Browsable(True),
[ReadOnly](False),
BindableAttribute(False), DefaultValue(800),
DesignOnly(False),
DescriptionAttribute("The speed of gradient turning.")>
    Public Property SpeedOfTurnGradient As Integer
        Get
            Return (1000 - speedtgv)

        End Get
        Set(ByVal value As Integer)
            If value >= 1000 Then
                value = 999
            ElseIf value = 0 Then
                value = 1
            End If
            speedtgv = 1000 - value
        End Set
    End Property
    Private speedtgv2 As Integer = FrmHyperAero.SpeedOfTurnGradient2
    ''' <summary>
    ''' Gets or sets  gradient turning animation speed.
    ''' </summary>
    <CategoryAttribute("Animation"),
Browsable(True),
[ReadOnly](False),
BindableAttribute(False), DefaultValue(4),
DesignOnly(False),
DescriptionAttribute("The speed of gradient turning.")>
    Public Property SpeedOfTurnGradient2 As Integer
        Get
            Return speedtgv2

        End Get
        Set(ByVal value As Integer)
            If value = 0 Then
                value = 1
            ElseIf value = 360 Then
                value = 361
            End If
            speedtgv2 = value
        End Set
    End Property

    Private isgv As Boolean = FrmHyperAero.GradientEnabled
    ''' <summary>
    ''' Gets or sets window background gradient enable.
    ''' </summary>
    <CategoryAttribute("Appearance"),
   Browsable(True),
   [ReadOnly](False),
   BindableAttribute(False), DefaultValue(False),
   DesignOnly(False),
 DescriptionAttribute("Is show gradient?")>
    Public Property GradientEnabled As Boolean
        Get
            Return isgv
        End Get
        Set(ByVal value As Boolean)
            isgv = value
        End Set
    End Property
    ''' <summary>
    ''' Gets or sets start location mode.
    ''' </summary>
    <CategoryAttribute("Layout"),
Browsable(True),
[ReadOnly](False),
BindableAttribute(False), DefaultValue(GetType(LocationMode), "None"),
DesignOnly(False),
DescriptionAttribute("The mode of start location.")>
    Public Property StartLocation As LocationMode = FrmHyperAero.StartLocation
    Private StartAnimationModev As AnimationMode = FrmHyperAero.StartAnimationMode
    ''' <summary>
    ''' Gets or sets animation start mode.
    ''' </summary>
    <CategoryAttribute("Animation"),
   Browsable(True),
   [ReadOnly](False),
   BindableAttribute(False), DefaultValue(GetType(AnimationMode), "ShortSlideFade"),
   DesignOnly(False),
 DescriptionAttribute("The mode of start animation.")>
    Public Property StartAnimationMode As AnimationMode
        Get
            Return StartAnimationModev
        End Get
        Set(ByVal value As AnimationMode)
            StartAnimationModev = value
        End Set
    End Property
    Private EndAnimationModev As AnimationMode = FrmHyperAero.EndAnimationMode
    ''' <summary>
    ''' Gets or sets animation end mode.
    ''' </summary>
    <CategoryAttribute("Animation"),
Browsable(True),
[ReadOnly](False),
BindableAttribute(False), DefaultValue(GetType(AnimationMode), "Fade"),
DesignOnly(False),
DescriptionAttribute("The mode of end animation.")>
    Public Property EndAnimationMode As AnimationMode
        Get
            Return EndAnimationModev
        End Get
        Set(ByVal value As AnimationMode)
            EndAnimationModev = value
        End Set
    End Property
    Private speedForslidex As Integer = FrmHyperAero.SpeedOfSlide
    Private speedForslide2x As Integer = FrmHyperAero.SpeedOfSlide2
    Private gradientModev As LinearGradientMode = FrmHyperAero.GradientMode
    ''' <summary>
    ''' Gets or sets window gradient mode.
    ''' if you want better option , use gradientAngel.
    ''' </summary>
    <CategoryAttribute("Appearance"),
Browsable(True),
[ReadOnly](False),
BindableAttribute(False), DefaultValue(GetType(LinearGradientMode), "Vertical"),
DesignOnly(False),
DescriptionAttribute("set this or set gradient angel to change gradient angel.")>
    Public Property GradientMode As LinearGradientMode
        Get
            Return gradientModev
        End Get
        Set(ByVal value As LinearGradientMode)
            gradientModev = value
        End Set
    End Property
    ''' <summary>
    ''' Gets or sets slide speed.
    ''' set this value smaller to have faster slide.
    ''' </summary>
    <CategoryAttribute("Animation"),
Browsable(True),
[ReadOnly](False),
BindableAttribute(False), DefaultValue(1),
DesignOnly(False),
DescriptionAttribute("The speed of slide.(smaller,faster)")>
    Public Property SpeedOfSlide As Integer
        Get
            Return speedForslidex
        End Get
        Set(ByVal value As Integer)
            If value <= 0 Then
                value = 1
            End If
            speedForslidex = value
        End Set
    End Property
    ''' <summary>
    ''' Gets or sets slide speed 2.
    ''' This option can faster slide very good.
    ''' </summary>
    <CategoryAttribute("Animation"),
Browsable(True),
[ReadOnly](False),
BindableAttribute(False), DefaultValue(3),
DesignOnly(False),
DescriptionAttribute("You can change speed with this property very good.")>
    Public Property SpeedOfSlide2 As Integer
        Get
            Return speedForslide2x
        End Get
        Set(ByVal value As Integer)
            If value <= 0 Then
                value = 1
            End If
            speedForslide2x = value
        End Set
    End Property
    Private setBlendv As Boolean = FrmHyperAero.SetBlend
    ''' <summary>
    ''' Gets or sets set blend enable.
    ''' </summary>
    <CategoryAttribute("Appearance"),
Browsable(True),
[ReadOnly](False),
BindableAttribute(False), DefaultValue(False),
DesignOnly(False),
DescriptionAttribute("Is set blend for gradient?")>
    Public Property SetBlend As Boolean
        Get
            Return setBlendv
        End Get
        Set(ByVal value As Boolean)
            setBlendv = value
        End Set
    End Property
    Private grdangel As Single = FrmHyperAero.GradientAngel
    ''' <summary>
    ''' Gets or sets notify dorm gradient angel.
    ''' </summary>
    <CategoryAttribute("Appearance"),
Browsable(True),
[ReadOnly](False),
BindableAttribute(False), DefaultValue(GetType(Single), "90"),
DesignOnly(False),
DescriptionAttribute("set this or set gradient mode to change gradient angel.")>
    Public Property GradientAngel As Single
        Get
            Return grdangel
        End Get
        Set(ByVal value As Single)
            grdangel = value
        End Set
    End Property
    Private TurnGradientEnablev As Boolean = FrmHyperAero.TurnGradientEnable
    ''' <summary>
    ''' Gets or sets turning gradient enable.
    ''' </summary>
    <CategoryAttribute("Animation"),
Browsable(True),
[ReadOnly](False),
BindableAttribute(False), DefaultValue(False),
DesignOnly(False),
DescriptionAttribute("Is show close button in the left of form?")>
    Public Property TurnGradientEnable As Boolean
        Get
            Return TurnGradientEnablev
        End Get
        Set(ByVal value As Boolean)
            TurnGradientEnablev = value
        End Set
    End Property
    ''' <summary>
    ''' Gets or sets window's opacity before Fade Animation.
    ''' </summary>
    <CategoryAttribute("Animation"),
Browsable(True),
[ReadOnly](False),
BindableAttribute(False), DefaultValue(GetType(Double), "0"),
DesignOnly(False),
DescriptionAttribute("Window's opacity before Fade Animation.")>
    Protected Property BeforeFadeOpacity As Double = FrmHyperAero.BeforeFadeOpacity
    ''' <summary>
    ''' Gets or sets window's opacity after Animation finish.
    ''' </summary>
    <CategoryAttribute("Animation"),
Browsable(True),
[ReadOnly](False),
BindableAttribute(False), DefaultValue(GetType(Double), "1"),
DesignOnly(False),
DescriptionAttribute("Window's opacity after Animation finish.")>
    Protected Property RealOpacity As Double = FrmHyperAero.RealOpacity
    Private blendv As Single = FrmHyperAero.BlendValue
    ''' <summary>
    ''' Gets or sets blend value.
    ''' Enter a number between 0-1.
    ''' </summary>
    <CategoryAttribute("Appearance"),
Browsable(True),
[ReadOnly](False),
BindableAttribute(False), DefaultValue(GetType(Single), "0.5"),
DesignOnly(False),
DescriptionAttribute("Set the focus number.Enter between 0 and 1.")>
    Public Property BlendValue As Single
        Get
            Return blendv
        End Get
        Set(ByVal value As Single)
            blendv = value
        End Set
    End Property
    ''' <summary>
    ''' Gets or sets start sound mode.
    ''' Set it with custom to use CustomSound property.
    ''' </summary>]
    <CategoryAttribute("Sound"),
    Description("Mode of a sound that played on start."),
    DefaultValue(GetType(SoundMode), "None")>
    Public Property StartSoundMode As SoundMode = FrmHyperAero.StartSoundMode
    ''' <summary>
    ''' Gets or sets Speed Of Fading 2.
    ''' </summary>
    <CategoryAttribute("Animation"),
    Description("Value to add to Opacity (Speed Of Fade 2)"),
    DefaultValue(GetType(Double), "0.04")>
    Public Property SpeedOfFade2 As Double = FrmHyperAero.SpeedOfFade2
    ''' <summary>
    ''' Gets or sets Speed Of End Animation Fading.
    ''' </summary>
    <CategoryAttribute("Animation"),
    Description("Value to remove from Opacity (Speed Of End Fade)"),
    DefaultValue(GetType(Double), "0.2")>
    Public Property SpeedOfEndFade As Double = FrmHyperAero.SpeedOfEndFade
    ''' <summary>
    ''' Gets or sets the Top of windows when Animation is finish.
    ''' </summary>
    <CategoryAttribute("Layout"),
    Description("The Top of windows when Animation is finish."),
    DefaultValue(200)>
    Protected Property RealTop As Integer = FrmHyperAero.RealTop
    ''' <summary>
    ''' Gets or sets a value indicating whether show Close button.
    ''' </summary>
    <CategoryAttribute("Window Style"),
Browsable(True),
[ReadOnly](False),
DefaultValue(True),
DesignOnly(False),
DescriptionAttribute("The tooltip's text.")>
    Protected Property CloseBox As Boolean = FrmHyperAero.CloseBox
    Dim RealIconv As Icon = FrmHyperAero.RealIcon
    ''' <summary>
    ''' Gets or sets icon of window.
    ''' </summary>
    <CategoryAttribute("Window Style"),
Browsable(True),
[ReadOnly](False),
DesignOnly(False),
DescriptionAttribute("The Icon of the Form.")>
    Protected Property RealIcon As Icon
        Get
            Return RealIconv
        End Get
        Set(ByVal value As Icon)
            RealIconv = value
        End Set
    End Property
    ''' <summary>
    ''' Gets or sets indicating whether Active window when window's vivible equal True.
    ''' </summary>
    <CategoryAttribute("Appearance"),
Browsable(True),
[ReadOnly](False),
DesignOnly(False),
DefaultValue(True),
DescriptionAttribute("Indicating whether Active window when window's vivible equal True.")>
    Protected Property StartupActive As Boolean = FrmHyperAero.StartupActive
    Private BackgorundGradientv As GradientBlend = FrmHyperAero.BackgroundGradient
    ''' <summary>
    ''' The ColorBlend used to fill the form.
    ''' </summary>
    <Description("The ColorBlend used to fill the form"), _
    Category("Appearance"), _
    Editor(GetType(BlendTypeEditor), GetType(UITypeEditor))> _
    Public Property BackgroundGradient() As GradientBlend
        Get
            Return BackgorundGradientv
        End Get
        Set(ByVal value As GradientBlend)
            BackgorundGradientv = value
        End Set
    End Property
#End Region
#Region "NewProperties"
    ''' <summary>
    ''' Gets is Aero Glass Enabled.
    ''' </summary>
    <Description("Is Aero Glass Enabled?"), Category("Aero"), DefaultValue(True)>
    Public Property AeroEnabled As Boolean = True
    ''' <summary>
    ''' Gets or sets Is Automatical change AeroBackgound to True when Aero is Enable?
    ''' </summary>
    <Description("Is Automatical change AeroBackgound to True when Aero is Enable?"), Category("Aero"), DefaultValue(True)>
    Public Property AutoAeroChange As Boolean = FrmHyperAero.AutoAeroChange
    ''' <summary>
    ''' Gets or sets Aero Background Enabled.
    ''' It's only work on Windows Vista or above and BackColor is Automatical set to Black and BackgroudImage set to Nothing and GradientEnabled set to False.
    ''' </summary>
    <Description("Is Automatical change AeroBackgound to True when Aero is Enable?"), Category("Aero"), DefaultValue(True)>
    Public Property AeroBackgroundEnabled As Boolean = FrmHyperAero.AeroBackgroundEnabled
    ''' <summary>
    ''' Gets or sets Labels Glow Value.
    ''' </summary>
    <Description("Sets Labels Glow Value."), Category("Aero"), DefaultValue(9)>
    Public Property GlowValue As Integer = FrmHyperAero.GlowValue
    ''' <summary>
    ''' Gets or sets Is Automatical call ShowLabel for Labels?
    ''' It can be slow in big forms.
    ''' </summary>
    <Description("Is Automatical call ShowLabel for Labels?" + vbNewLine + "It can be slow in big forms."), Category("Aero"), DefaultValue(True)>
    Public Property AutoShowLabels As Boolean = FrmHyperAero.AutoShowLabels
    Private rtlv As Boolean = FrmHyperAero.RightToLeft
    ''' <summary>
    ''' Gets or sets right to left Enabled.
    ''' </summary>
    <CategoryAttribute("Appearance"),
Browsable(True),
[ReadOnly](False),
BindableAttribute(False), DefaultValue(False),
DesignOnly(False),
DescriptionAttribute("Is show text right to left?")>
    Public Property RightToLeft As Boolean
        Get
            Return rtlv
        End Get
        Set(ByVal value As Boolean)
            rtlv = value
        End Set
    End Property
    Private bgi As System.Drawing.Bitmap = FrmHyperAero.BackgroundImage
    ''' <summary>
    ''' Gets or sets window's Background Image.
    ''' </summary>
    <CategoryAttribute("Appearance"),
    Browsable(True),
    [ReadOnly](False),
    BindableAttribute(False),
    DesignOnly(False),
    DescriptionAttribute("An image for background of the window.")>
    Public Property BackgroundImage As System.Drawing.Bitmap
        Get
            Return bgi
        End Get
        Set(ByVal value As System.Drawing.Bitmap)
            bgi = value
        End Set

    End Property
    Private backColorv As Color = FrmHyperAero.BackColor
    ''' <summary>
    ''' Gets or sets window's back color.
    ''' set background image with nothing to show backcolor.
    ''' </summary>
    <CategoryAttribute("Appearance"),
   Browsable(True),
   [ReadOnly](False),
   BindableAttribute(False), DefaultValue(GetType(Color), "control"),
   DesignOnly(False),
 DescriptionAttribute("Set the backgroundimage to nothing and set backColor to have solid background.")>
    Public Property BackColor As Color
        Get
            Return backColorv
        End Get
        Set(ByVal value As Color)
            backColorv = value
        End Set
    End Property
    Private foreColorv As Color = FrmHyperAero.ForeColor
    ''' <summary>
    ''' Gets or sets note color.
    ''' </summary>
    <CategoryAttribute("Appearance"),
Browsable(True),
[ReadOnly](False),
BindableAttribute(False), DefaultValue(GetType(Color), "white"),
DesignOnly(False),
DescriptionAttribute("The color of the text.")>
    Public Property ForeColor As Color
        Get
            Return foreColorv
        End Get
        Set(ByVal value As Color)
            foreColorv = value
        End Set
    End Property
#End Region
    Protected Overridable Sub Update()
        FrmHyperAero.RealTop = RealTop
        FrmHyperAero.RealOpacity = RealOpacity
        FrmHyperAero.RealIcon = RealIcon
        FrmHyperAero.BeforeFadeOpacity = BeforeFadeOpacity
        FrmHyperAero.BlendValue = BlendValue
        FrmHyperAero.SetBlend = SetBlend
        FrmHyperAero.SpeedOfEndFade = SpeedOfEndFade
        FrmHyperAero.SpeedOfFade = SpeedOfFade
        FrmHyperAero.SpeedOfFade2 = SpeedOfFade2
        FrmHyperAero.SpeedOfSlide = SpeedOfSlide
        FrmHyperAero.SpeedOfSlide2 = SpeedOfSlide2
        FrmHyperAero.SpeedOfTurnGradient = SpeedOfTurnGradient
        FrmHyperAero.SpeedOfTurnGradient2 = SpeedOfTurnGradient2
        FrmHyperAero.StartLocation = StartLocation
        FrmHyperAero.StartSoundMode = StartSoundMode
        FrmHyperAero.StartupActive = StartupActive
        FrmHyperAero.GradientEnabled = GradientEnabled
        FrmHyperAero.GradientAngel = GradientAngel
        FrmHyperAero.BackgroundGradient = BackgroundGradient
        FrmHyperAero.GradientMode = GradientMode
        FrmHyperAero.TurnGradientEnable = TurnGradientEnable
        FrmHyperAero.CloseBox = CloseBox
        FrmHyperAero.CustomSound = CustomSound
        FrmHyperAero.CustomSoundLocation = CustomSoundLocation
        FrmHyperAero.StartAnimationMode = StartAnimationMode
        FrmHyperAero.EndAnimationMode = EndAnimationMode
        FrmHyperAero.RightToLeft = RightToLeft
        FrmHyperAero.BackgroundImage = BackgroundImage
        FrmHyperAero.BackColor = BackColor
        FrmHyperAero.ForeColor = ForeColor
        FrmHyperAero.AutoAeroChange = AutoAeroChange
        FrmHyperAero.AeroBackgroundEnabled = AeroBackgroundEnabled
        FrmHyperAero.AutoShowLabels = AutoShowLabels
        FrmHyperAero.GlowValue = GlowValue
        FrmHyperAero.AeroEnabled = AeroEnabled
    End Sub
#End Region
End Class
